﻿//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: StorageConstraingException.cs
//
//  Description: Exception is thrown if a constraint is violated.
// 
//--------------------------------------------------------------------------

using System;
using Chili.Opf3.Query;

namespace Chili.Opf3.Storages
{
	/// <summary>
	/// Exception is thrown if a constraint in the storage has been violated while 
	/// persisting an object.
	/// </summary>
	[Serializable]
	public sealed class StorageConstraintException : StorageException
	{
		/// <summary>
		/// Creates a new instance of the
		/// <see cref="StorageConstraintException">StorageConstraintException Class</see>.
		/// </summary>
		private StorageConstraintException(System.Runtime.Serialization.SerializationInfo info,
		  System.Runtime.Serialization.StreamingContext context) : base(info, context)
		{
		}

		/// <summary>
		/// Creates a new instance of the
		/// <see cref="StorageConstraintException">StorageConstraintException Class</see>.
		/// </summary>
		/// <param name="query">Query that has been executed before the exception has been thrown.</param>
		public StorageConstraintException(IQuery query) : base(query)
		{
		}

		/// <summary>
		/// Creates a new instance of the
		/// <see cref="StorageConstraintException">StorageConstraintException Class</see>.
		/// </summary>
		/// <param name="message">A message that describes the current exception.</param>
		/// <param name="query">Query that has been executed before the exception has been thrown.</param>
		public StorageConstraintException(string message, IQuery query) : base(message, query)
		{
		}

		/// <summary>
		/// Creates a new instance of the
		/// <see cref="StorageConstraintException">StorageConstraintException Class</see>.
		/// </summary>
		/// <param name="message">A message that describes the current exception.</param>
		/// <param name="inner">The exception that caused the current exception.</param>
		/// <param name="query">Query that has been executed before the exception has been thrown.</param>
		public StorageConstraintException(string message, System.Exception inner, IQuery query) 
			: base(message, inner, query)
		{
		}
	}
}
